COS

The periodic function COS returns the trigonometric cosine of X.

Examples

Find the cosine of 0.5 radians and print the result by entering:

PRINT, COS(.5)

IDL prints:

0.877583

Syntax

Result = COS(X)

Return Value

Returns the trigonometric cosine of X.

Arguments

X

The angle for which the cosine is desired, specified in radians. If X is double-precision floating or complex, the result is of the same type. All other types are converted to single-precision floating-point and yield floating-point results. When applied to complex numbers:

COS(x) = (EXP(i*x) + 1/EXP(i*x))/2

where i is defined as COMPLEX(0, 1).

If X is an array, the result has the same structure, with each element containing the cosine of the corresponding element of X.

Keywords

Thread Pool Keywords

This routine is written to make use of IDL’s thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the !CPU system variable control whether IDL uses the thread pool for a given computation. In addition, you can use the thread pool keywords TPOOL_MAX_ELTS, TPOOL_MIN_ELTS, and TPOOL_NOTHREAD to override the defaults established by !CPU for a single invocation of this routine. See Thread Pool Keywords for details.

Version History

Original

Introduced

See Also

ACOS, COSH